/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.emmanuel.modelo.dto;

import java.io.Serializable;

/**
 *
 * @author Emmanuel
 */
public class PeliculaDTO implements Serializable{
    
    private static final String SELECT_ALL_COUNT = "select count(*) from regpeliculas ";
    private static final String SELECT_ALL = "select * from regpeliculas ";
    private static final String INSERT = "insert into peliculas(carnet,nombres,apellidos,${0}) "
            + "values(?,?,?,${1})";
    private static final String DELETE = "delete from peliculas where id=?";
    private static final String UPDATE_BASE = "UPDATE peliculas SET ${0} WHERE id = ?";
    private static final String SELECT_LIKE_NOMBRES="select * from peliculas where nombre_pelicula like ?";
    private Integer id_pelicula;
    private String nombre_pelicula;
    private String actor_principal;
    private String director_pelicula;
    private String genero_pelicula;
    private String duracion_pelicula;

    public PeliculaDTO() {
    }

    public Integer getid_pelicula() {
        return id_pelicula;
    }

    public void setId(Integer id_pelicula) {
        this.id_pelicula = id_pelicula;
    }

    public String getnombre_pelicula() {
        return nombre_pelicula;
    }

    public void setnombre_pelicula(String nombre_pelicula) {
        this.nombre_pelicula = nombre_pelicula;
    }

    public String getactor_principal() {
        return actor_principal;
    }

    public void setactor_principal(String actor_principal) {
        this.actor_principal = actor_principal;
    }

    public String getdirector_pelicula() {
        return director_pelicula;
    }

    public void setdirector_pelicula(String director_pelicula) {
        this.director_pelicula = director_pelicula;
    }

    public String getgenero_pelicula() {
        return genero_pelicula;
    }

    public void setgenero_pelicula(String genero_pelicula) {
        this.genero_pelicula = genero_pelicula;
    }

    public String getduracion_pelicula() {
        return duracion_pelicula;
    }

    public void setduracion_pelicula(String duracion_pelicula) {
        this.duracion_pelicula = duracion_pelicula;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + (this.id_pelicula != null ? this.id_pelicula.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final PeliculaDTO other = (PeliculaDTO) obj;
        if (this.id_pelicula != other.id_pelicula && (this.id_pelicula == null || !this.id_pelicula.equals(other.id_pelicula))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "PeliculasDTO{" + "id_pelicula=" + id_pelicula + ", nombre_pelicula=" + nombre_pelicula + ", actor_principal=" + actor_principal + ", director_pelicula=" + director_pelicula + ", genero_pelicula=" + genero_pelicula + ", duracion_pelicula=" + duracion_pelicula + '}';

    }

    public static String getInsert(StringBuilder cols, StringBuilder marks) {

        if (cols.length() == 0 && marks.length() == 0) {

            return INSERT.replace(",${0}", "").replace(",${1}", "");
        } else {

            return INSERT.replace("${0}", cols.toString()).replace("${1}", marks.toString());
        }

    }

    public static String getUpdate(StringBuilder colsAndMarks) {

        if (colsAndMarks.length() == 0) {

            return UPDATE_BASE;
        } else {

            return UPDATE_BASE.replace("${0}", colsAndMarks.toString());
        }

    }

    public static String getSELECT_ALL() {
        return SELECT_ALL;
    }

    public static String getSELECT_ALL_COUNT() {
        return SELECT_ALL_COUNT;
    }

    public static String getDELETE() {
        return DELETE;
    }

    public static String getSELECT_LIKE_NOMBRES() {
        return SELECT_LIKE_NOMBRES;
    }
    
     
}
